package com.sskj.hangqing.ui.fragment;


import android.text.TextUtils;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;

import com.alibaba.android.arouter.launcher.ARouter;
import com.sskj.common.util.ClickUtil;
import com.sskj.common.util.SPUtil;
import com.sskj.common.util.ToastUtil;
import com.sskj.hangqing.R;
import com.sskj.hangqing.R2;
import com.sskj.hangqing.component.DaggerUserDataComponent;
import com.sskj.hangqing.presenter.BoxFragmentPresenter;
import com.sskj.lib.RConfig;
import com.sskj.lib.SPConfig;
import com.sskj.lib.base.BaseFragment;
import com.sskj.lib.bean.UserData;
import com.sskj.lib.model.room.UserViewModel;
import com.sskj.lib.util.AppCircleCheckUtil;

import javax.inject.Inject;

import butterknife.BindView;


public class BoxFragment extends BaseFragment<BoxFragmentPresenter> {
    @BindView(R2.id.ivShop)
    ImageView ivShop;
    @BindView(R2.id.ivGame)
    ImageView ivGame;
    @Inject
    UserViewModel userViewModel;
    UserData userData;

    @Override
    protected int getLayoutId() {
        return R.layout.hang_fragment_box;
    }

    @Override
    public BoxFragmentPresenter getPresenter() {
        return new BoxFragmentPresenter();
    }

    @Override
    protected void initView() {
        DaggerUserDataComponent.create().inject(this);
        userViewModel.getUsers().observe(this, users -> {
            if (users != null && users.size() > 0) {
                userData = users.get(0);
            } else {
                userData = null;
            }
        });
        ClickUtil.click(ivShop, () -> {
            ARouter.getInstance().build(RConfig.MARKET_ACTIVITY_SHOPPING).navigation();

        });
        ClickUtil.click(ivGame, () -> {
            ARouter.getInstance().build(RConfig.RUN_RUN).navigation();
//            ToastUtil.showShort(App.INSTANCE.getString(R.string.hang_boxFragment1));

        });
    }
}



